Optimal. Leaf size=109 \[ \frac{2 a^2 (B+i A) (c-i c \tan (e+f x))^n}{f n}-\frac{a^2 (3 B+i A) (c-i c \tan (e+f x))^{n+1}}{c f (n+1)}+\frac{a^2 B (c-i c \tan (e+f x))^{n+2}}{c^2 f (n+2)} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.163657, antiderivative size = 109, normalized size of antiderivative = 1., number of steps used = 3, number of rules used = 2, integrand size = 41, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.049, Rules used = {3588, 77} \[ \frac{2 a^2 (B+i A) (c-i c \tan (e+f x))^n}{f n}-\frac{a^2 (3 B+i A) (c-i c \tan (e+f x))^{n+1}}{c f (n+1)}+\frac{a^2 B (c-i c \tan (e+f x))^{n+2}}{c^2 f (n+2)} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 3588
Rule 77
Rubi steps
\begin{align*} \int (a+i a \tan (e+f x))^2 (A+B \tan (e+f x)) (c-i c \tan (e+f x))^n \, dx &=\frac{(a c) \operatorname{Subst}\left (\int (a+i a x) (A+B x) (c-i c x)^{-1+n} \, dx,x,\tan (e+f x)\right )}{f}\\ &=\frac{(a c) \operatorname{Subst}\left (\int \left (2 a (A-i B) (c-i c x)^{-1+n}-\frac{a (A-3 i B) (c-i c x)^n}{c}-\frac{i a B (c-i c x)^{1+n}}{c^2}\right ) \, dx,x,\tan (e+f x)\right )}{f}\\ &=\frac{2 a^2 (i A+B) (c-i c \tan (e+f x))^n}{f n}-\frac{a^2 (i A+3 B) (c-i c \tan (e+f x))^{1+n}}{c f (1+n)}+\frac{a^2 B (c-i c \tan (e+f x))^{2+n}}{c^2 f (2+n)}\\ \end{align*}
Mathematica [A] time = 6.62668, size = 146, normalized size = 1.34 \[ \frac{a^2 \sec ^2(e+f x) (c \sec (e+f x))^n \left (\left (B \left (n^2+2 n+4\right )+i A (n+2)^2\right ) \cos (2 (e+f x))-n (A (n+2)-i B (n+4)) \sin (2 (e+f x))+(n+2) (-B (n-2)+i A (n+2))\right ) \exp (n (-\log (c \sec (e+f x))+\log (c-i c \tan (e+f x))))}{2 f n (n+1) (n+2)} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [B] time = 0.49, size = 280, normalized size = 2.6 \begin{align*}{\frac{in{{\rm e}^{n\ln \left ( c-ic\tan \left ( fx+e \right ) \right ) }}A{a}^{2}}{f \left ( 1+n \right ) \left ( 2+n \right ) }}+{\frac{4\,i{{\rm e}^{n\ln \left ( c-ic\tan \left ( fx+e \right ) \right ) }}A{a}^{2}}{f \left ( 1+n \right ) \left ( 2+n \right ) }}+{\frac{4\,i{{\rm e}^{n\ln \left ( c-ic\tan \left ( fx+e \right ) \right ) }}A{a}^{2}}{fn \left ( 1+n \right ) \left ( 2+n \right ) }}+{\frac{{{\rm e}^{n\ln \left ( c-ic\tan \left ( fx+e \right ) \right ) }}{a}^{2}B}{f \left ( 1+n \right ) \left ( 2+n \right ) }}+4\,{\frac{{{\rm e}^{n\ln \left ( c-ic\tan \left ( fx+e \right ) \right ) }}{a}^{2}B}{fn \left ( 1+n \right ) \left ( 2+n \right ) }}-{\frac{{a}^{2}B \left ( \tan \left ( fx+e \right ) \right ) ^{2}{{\rm e}^{n\ln \left ( c-ic\tan \left ( fx+e \right ) \right ) }}}{f \left ( 2+n \right ) }}-{\frac{{a}^{2} \left ( -iBn+An-4\,iB+2\,A \right ) \tan \left ( fx+e \right ){{\rm e}^{n\ln \left ( c-ic\tan \left ( fx+e \right ) \right ) }}}{f \left ( 1+n \right ) \left ( 2+n \right ) }} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [B] time = 2.42606, size = 902, normalized size = 8.28 \begin{align*} \text{result too large to display} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [B] time = 1.43118, size = 498, normalized size = 4.57 \begin{align*} \frac{{\left ({\left (2 i \, A - 2 \, B\right )} a^{2} n +{\left (4 i \, A + 4 \, B\right )} a^{2} +{\left ({\left (2 i \, A + 2 \, B\right )} a^{2} n^{2} +{\left (6 i \, A + 6 \, B\right )} a^{2} n +{\left (4 i \, A + 4 \, B\right )} a^{2}\right )} e^{\left (4 i \, f x + 4 i \, e\right )} +{\left ({\left (2 i \, A - 2 \, B\right )} a^{2} n^{2} + 8 i \, A a^{2} n +{\left (8 i \, A + 8 \, B\right )} a^{2}\right )} e^{\left (2 i \, f x + 2 i \, e\right )}\right )} \left (\frac{2 \, c}{e^{\left (2 i \, f x + 2 i \, e\right )} + 1}\right )^{n}}{f n^{3} + 3 \, f n^{2} + 2 \, f n +{\left (f n^{3} + 3 \, f n^{2} + 2 \, f n\right )} e^{\left (4 i \, f x + 4 i \, e\right )} + 2 \,{\left (f n^{3} + 3 \, f n^{2} + 2 \, f n\right )} e^{\left (2 i \, f x + 2 i \, e\right )}} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F(-2)] time = 0., size = 0, normalized size = 0. \begin{align*} \text{Exception raised: AttributeError} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [F] time = 0., size = 0, normalized size = 0. \begin{align*} \int{\left (B \tan \left (f x + e\right ) + A\right )}{\left (i \, a \tan \left (f x + e\right ) + a\right )}^{2}{\left (-i \, c \tan \left (f x + e\right ) + c\right )}^{n}\,{d x} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]